package com.zmn.oms.model.entity.conf.cancel;

import com.zmn.common.utils.pager.Operator;
import lombok.*;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @author tanbiao
 * @description
 * @since 2019/10/21 17:31
 * @modifier
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class OrderCancelCategory extends Operator implements Comparable<OrderCancelCategory> {
    /**
     * 分类id
     */
    private Integer categId;

    /**
     * 取消分类名称
     */
    private String name;

    /**
     * 首字母
     */
    private String firstLetter;

    /**
     * 排序号，编号越小越靠前
     */
    private Integer sort;

    /**
     * 状态：1停用，2启用
     */
    private Integer status;

    /**
     * 创建人
     */
    private String creater;

    /**
     * 修改人
     */
    private String updater;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    @Override
    @SuppressWarnings("Duplicates")
    public int compareTo(OrderCancelCategory k) {
        int result = this.getSort().compareTo(k.getSort());
        if (result == 0) {
            Date edate = this.getUpdateTime();
            Date kdate = k.getUpdateTime();
            if (edate != null && kdate != null) {
                return kdate.compareTo(edate);
            } else {
                if (edate == null && kdate != null) {
                    return 1;
                } else if (edate != null && kdate == null) {
                    return -1;
                } else {
                    return 0;
                }
            }
        }
        return result;
    }
}
